<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue使用之js动画</title>
    <script src="../vue.js" type="text/javascript"></script>
    <script src="../velocity.min.js" type="text/javascript"></script>
</head>
<body>
<div id="app">
    <transition @before-enter="Before" @enter="Enter" @after-enter="After">
        <div v-show="show">hello</div>
    </transition>
    <button @click="change">变化</button>
</div>
<script>
    var app=new Vue({
        el:"#app",
        data:{
            show: true
        },
        methods:{
            change: function () {
                this.show = !this.show
            },
            Before:function (el) {
                el.style.opacity=0;

            },
            Enter:function (el,done) {
                Velocity(
                    el,
                    {opacity: 1},
                    {
                        duration: 2000,
                        complete:done
                    }
                )

            },
            After:function () {
                alert('动画完成')
            }
        }
    })
</script>
</body>
</html>